package cn.tpshion.shop.controller;

import cn.tpshion.shop.common.R;
import cn.tpshion.shop.domain.dto.TaskTakeDTO;
import cn.tpshion.shop.domain.vo.TaskVO;
import cn.tpshion.shop.service.TaskService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/task")
public class TaskController {

    @Resource
    private TaskService taskService;

    @GetMapping("/info")
    public R<TaskVO> info() {
        return R.ok(taskService.info());
    }

    @PostMapping("/success")
    public R<Void> success(@RequestBody TaskTakeDTO dto) {
        taskService.success(dto);
        return R.ok();
    }

    @PostMapping("/take")
    public R<Void> take(@RequestBody TaskTakeDTO dto) {
        taskService.take(dto);
        return R.ok();
    }
}
